package com.newcoder.community.service;

import org.springframework.stereotype.Service;

import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
/*
* target:容器管理Bean的初始化、销毁
* time:2021/7/24 10:54
* */

@Service
//@Scope("prototype")
public class AlphaService {

    public AlphaService(){
        System.out.println("实例化AlphaService");
    }

    @PostConstruct  //初始化方法会在构造器之后调用
    public void init(){
        System.out.println("初始化AlphaService");
    }

    @PreDestroy  //在销毁对象之前调用它
    public void destory(){
        System.out.println("销毁AlphaService");
    }
}
